package cn.jilian.trans.bizz.service.impl;

import java.math.BigDecimal;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.jilian.trans.bizz.domain.OrderPost;
import cn.jilian.trans.bizz.domain.Trans;
import cn.jilian.trans.bizz.dto.TransOrder;
import cn.jilian.trans.bizz.dto.TransPostOrder;
import cn.jilian.trans.bizz.dto.TransPostOrderDetail;
import cn.jilian.trans.bizz.service.OrderService;
import cn.jilian.trans.bizz.service.PostService;
import cn.jilian.trans.bizz.service.TransService;



@Service
public class PostServiceImpl implements PostService {
	
	@Autowired
	private OrderService orderService;
	@Autowired
	private TransService transService;
	

	

	@Override
	public TransPostOrder query(long postId) {
//		OrderPost post=orderPostEntity.findById(postId, OrderPost.class);
//		if(post==null)
//		return null;
//		Long orderId=post.getFid();
//		TransOrder order=orderService.queryOrderBySid(orderId);
//		Trans trans=transService.findBySid(post.getRid());
		TransPostOrder transPostOrder=new TransPostOrder();
		
//		transPostOrder.setOrderId(order.getSid());
//		transPostOrder.setBrand(order.getBrand());
//		transPostOrder.setBuilder(order.getBuilder());
//		transPostOrder.setContact(order.getContact());
//		transPostOrder.setMobile(order.getMobile());
//		transPostOrder.setName(order.getName());
//		transPostOrder.setStartDate(order.getStartDate());
//		transPostOrder.setEndDate(order.getEndDate());
//		transPostOrder.setStartAddr(order.getStartAddr());
//		transPostOrder.setEndAddr(order.getEndAddr());
//		transPostOrder.setTransContact(trans.getContactName());
//		transPostOrder.setTransMobile(trans.getContactMobile());
//		transPostOrder.setPostId(post.getSid());
//		transPostOrder.setPostAmt(post.getPrice());
		return transPostOrder;
	}

	@Override
	public TransPostOrderDetail queryWithDetail(long postId) {
//		return orderPostEntity.findById(postId, TransPostOrderDetail.class);
		return null;
	}

	@Override
	public List<TransPostOrder> queryPostList(long orderId) {
//		JavaType type=objectMapper.getTypeFactory().constructCollectionType(List.class, TransPostOrder.class);
//		return orderPostEntity.queryListByFid(orderId, type);
		return null;
	}

	@Override
	public int saveOrderItemPost(long orderItemId, long transId, BigDecimal price) {
		
		return 1;
	}

	@Override
	public TransPostOrder query(long orderId, long transId) {
		
		return null;
	}

	@Override
	public int save(TransPostOrder order) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int save(TransPostOrderDetail order) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public TransPostOrderDetail queryDetailedPost(long orderId, long transId) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
